package pl.makimo.fuzzy.linguistics;

import java.util.ArrayList;
import java.util.List;

import pl.makimo.data.Record;
import pl.makimo.fuzzy.sets.ContinuousFuzzySet;
import pl.makimo.fuzzy.sets.FuzzySet;

public class Qualifier<T> {
	public String label;
	public String variable;
	public FuzzySet<T> set;
	
	@Override
	public String toString() {
		return label + " " + variable;
	}
	
	public List<Qualifier<T>> getSingleQualifiers() {
		List<Qualifier<T>> qualifiers = new ArrayList<Qualifier<T>>();
		qualifiers.add(this);
		return qualifiers;
	}	
	
	public static <E> Qualifier<E> fromLinguisticVariable(LinguisticVariable<E> variable, String label) {
		FuzzySet<E> set = variable.labels.get(label);
		
		Qualifier<E> qualifier = new Qualifier<E>();
		qualifier.set = set;
		qualifier.label = label;
		qualifier.variable = variable.name;
		
		return qualifier;
	}	
}
